function ModuleDialogAddTransition(doc, container, width, height, user, date, options) {
  this._doc = doc;
  this._container = container;
  this._width = width;
  this._height = height;
  this._user = user;
  this._date = date;
  this._options = options;
  
  this._object = (options && options.object) ? options.object : null;
  this._states = (options && options.states) ? options.states : [];
  this._popupBox = (options && options.popupBox) ? options.popupBox : null;
  this._callbackFunc = (options && options.callbackFunc) ? options.callbackFunc : null;
  
  this._createElements();
};

ModuleDialogAddTransition.prototype._createElements = function() {
  var unique = MiscUtils.unique(), _self = this;
  this._gui = new DialogAddTransition(this._doc, this._container, this._width, this._height, this._user, this._date, this._options)._gui;
  
  if (this._object.id) {
    this._gui.add.value = 'Update';
  }
  
  this._gui.name.value = this._object.name;
  this._gui.name.onchange = function() { _self._object.name = this.value; };
  
  this._gui.source.options[this._gui.source.options.length] = new Option('');
  for (var i = 0, il = this._states.length; i < il; i++) {
    var state = this._states[i];
    option = new Option(state.name);
    option._state = state;
    this._gui.source.options[this._gui.source.options.length] = option;
    if (option._state.id == this._object.source_id) {
      this._gui.source.selectedIndex = this._gui.source.options.length - 1;
    }
  }
  this._gui.source.onchange = function() { _self._object.source_id = (this.options[this.selectedIndex]._state) ? this.options[this.selectedIndex]._state.id : ''; };
  
  this._gui.target.options[this._gui.target.options.length] = new Option('');
  for (var i = 0, il = this._states.length; i < il; i++) {
    var state = this._states[i];
    option = new Option(state.name);
    option._state = state;
    this._gui.target.options[this._gui.target.options.length] = option;
    if (option._state.id == this._object.target_id) {
      this._gui.target.selectedIndex = this._gui.target.options.length - 1;
    }
  }
  this._gui.target.onchange = function() { _self._object.target_id = (this.options[this.selectedIndex]._state) ? this.options[this.selectedIndex]._state.id : ''; };
  
  this._gui.userType.options[this._gui.userType.options.length] = new Option('');
  for (var i = 0, il = UserType.array().length; i < il; i++) {
    var type = UserType.array()[i];
    option = new Option(type);
    this._gui.userType.options[this._gui.userType.options.length] = option;
    if (option.text == this._object.user_type) {
      this._gui.userType.selectedIndex = this._gui.userType.options.length - 1;
    }
  }
  this._gui.userType.onchange = function() { _self._object.user_type = this.options[this.selectedIndex].text; };
  
  this._gui.day.value = this._object.day;
  this._gui.day.onchange = function() { _self._object.day = this.value; };
  
  this._gui.add.onclick = function() { if (_self._object.name == '') {
                                         window.alert('name不能为空');
                                       } else if (_self._object.source_id == '') {
                                         window.alert('source不能为空');
                                       } else if (_self._object.target_id == '') {
                                         window.alert('target不能为空');
                                       } else {
                                         new RequestUtils()._write('pz_model_transition', [_self._object], [], function() { _self._callbackFunc(); }, {pos: DOMUtils.findPos(this)});
                                         _self._popupBox._close();
                                       }
                                     };
  this._gui.cancel.onclick = function() { _self._popupBox._close(); };
};